package base;

public class Phone extends Electronics {
    private String OS;
    private double storage;

    /**
     * invoke parent class constructor method and instance variable.
     * @param initWeight
     * @param initPrice
     * @param initPower
     *
     * @param initManufacturer
     * @param initOS
     * @param initStorage
     */
    public Phone(double initWeight, double initPrice, double initPower, String initManufacturer, String initOS, double initStorage) {
        super(initWeight, initPrice, initPower, initManufacturer);
        try {
            this.storage = initStorage;
        } catch (Exception e) {
            System.out.println("input must be a number");
        }
        this.OS = initOS;
    }

    /**
     * set the OS information of phones
     * @param new_OS
     */
    public void setOS_info(String new_OS) {
        this.OS = new_OS;
    }

    /**
     * set the storage information of phones
     * @param new_storage
     */
    public void setStorage_info(double new_storage) {
        try {
            this.storage = new_storage;
        } catch (Exception e) {
            System.out.println("input must be a number");
        }
    }

    /**
     * get the os information of phones
     * @return
     */
    public String getOS_info() {
        return this.OS;
    }

    /**
     * get the storage information of phones
     * @return
     */
    public double getStorage_info() {
        return this.storage;
    }

    /**
     * output phones' infos
     */
    public void show_Phone() {
        System.out.println("Here is the information of this phone");
        super.outputInfo();
        System.out.println("OS: " + this.OS);
        System.out.println("storage: " + this.storage);
    }
}